home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / zip.zip / TAILOR.H < prev    next >
C/C++ Source or Header  |  1992-09-22  |  3KB  |  153 lines

  1. /* tailor.h -- Not copyrighted 1991 Mark Adler */
  2.  
  3. /* const's are inconsistently used across ANSI libraries--kill for all
  4.    header files. */
  5. #define const
  6.  
  7.  
  8. /* Use prototypes and ANSI libraries if __STDC__ */
  9. #ifdef __STDC__
  10. #  ifndef PROTO
  11. #    define PROTO
  12. #  endif /* !PROTO */
  13. #  define MODERN
  14. #endif /* __STDC__ */
  15.  
  16.  
  17. /* Use prototypes and ANSI libraries if Silicon Graphics */
  18. #ifdef sgi
  19. #  ifndef PROTO
  20. #    define PROTO
  21. #  endif /* !PROTO */
  22. #  define MODERN
  23. #endif /* sgi */
  24.  
  25.  
  26. /* Define MSDOS for Turbo C as well as Microsoft C */
  27. #ifdef __POWERC                 /* For Power C too */
  28. #  define __TURBOC__
  29. #endif /* __POWERC */
  30. #ifdef __TURBOC__
  31. #  ifndef MSDOS
  32. #    define MSDOS
  33. #  endif /* !MSDOS */
  34. #endif /* __TURBOC__ */
  35.  
  36.  
  37. /* Use prototypes and ANSI libraries if Microsoft or Borland C */
  38. #ifdef MSDOS
  39. #  ifndef PROTO
  40. #    define PROTO
  41. #  endif /* !PROTO */
  42. #  define MODERN
  43. #endif /* MSDOS */
  44.  
  45.  
  46. /* Turn off prototypes if requested */
  47. #ifdef NOPROTO
  48. #  ifdef PROTO
  49. #    undef PROTO
  50. #  endif /* PROTO */
  51. #endif /* NOPROT */
  52.  
  53.  
  54. /* Used to remove arguments in function prototypes for non-ANSI C */
  55. #ifdef PROTO
  56. #  define OF(a) a
  57. #else /* !PROTO */
  58. #  define OF(a) ()
  59. #endif /* ?PROTO */
  60.  
  61.  
  62. /* Allow far and huge allocation for small model (Microsoft C or Turbo C) */
  63. #ifdef MSDOS
  64. #  ifdef __TURBOC__
  65. #    include <alloc.h>
  66. #  else /* !__TURBOC__ */
  67. #    include <malloc.h>
  68. #    define farmalloc _fmalloc
  69. #    define farfree   _ffree
  70. #  endif /* ?__TURBOC__ */
  71. #else /* !MSDOS */
  72. #  define huge
  73. #  define far
  74. #  define near
  75. #  define farmalloc malloc
  76. #  define farfree   free
  77. #endif /* ?MSDOS */
  78.  
  79.  
  80. /* Define MSVMS if either MSDOS or VMS defined */
  81. #ifdef MSDOS
  82. #  define MSVMS
  83. #else /* !MSDOS */
  84. #  ifdef VMS
  85. #    define MSVMS
  86. #  endif /* VMS */
  87. #endif /* ?MSDOS */
  88.  
  89.  
  90. /* Define void, voidp, and extent (size_t) */
  91. #include <stdio.h>
  92. #ifdef MODERN
  93. #  ifndef M_XENIX
  94. #    include <stddef.h>
  95. #  endif /* !M_XENIX */
  96. #  include <stdlib.h>
  97.    typedef size_t extent;
  98.    typedef void voidp;
  99. #else /* !MODERN */
  100.    typedef unsigned int extent;
  101. #  define void int
  102.    typedef char voidp;
  103. #endif /* ?MODERN */
  104.  
  105. /* Get types and stat */
  106. #ifdef VMS
  107. #  include <types.h>
  108. #  include <stat.h>
  109. #else /* !VMS */
  110. #  include <sys/types.h>
  111. #  include <sys/stat.h>
  112. #endif /* ?VMS */
  113.  
  114.  
  115. /* Cheap fix for unlink on VMS */
  116. #ifdef VMS
  117. #  define unlink delete
  118. #endif /* VMS */
  119.  
  120.  
  121. /* For Pyramid */
  122. #ifdef pyr
  123. #  define strrchr rindex
  124. #  define ZMEM
  125. #endif /* pyr */
  126.  
  127.  
  128. /* File operations--use "b" for binary if allowed */
  129. #ifdef MODERN
  130. #  define FOPR "rb"
  131. #  define FOPM "r+b"
  132. #  define FOPW "w+b"
  133. #else /* !MODERN */
  134. #  define FOPR "r"
  135. #  define FOPM "r+"
  136. #  define FOPW "w+"
  137. #endif /* ?MODERN */
  138.  
  139.  
  140. /* Fine tuning */
  141. #ifndef MSDOS
  142. #   define BSZ 8192   /* Buffer size for files */
  143. #else /* !MSDOS */
  144. #   define BSZ 4096   /* Keep precious NEAR space */
  145.     /* BSZ can't be 8192 even for compact model because of 64K limitation
  146.      * in im_lmat.c. If you run out of memory when processing a large number
  147.      * files, use the compact model and reduce BSZ to 2048 here and in
  148.      * im_lm.asm.
  149.      */
  150. #endif /* ?MSDOS */
  151.  
  152. /* end of tailor.h */
  153.